require('babel-polyfill')
import Koa from 'koa'
import { createToken } from './qiniu';

const app = new Koa()

var cors = require('./koa-cors');
app.use(cors);

app.use(async (ctx, next) => {
  if (ctx.req.url === '/qiniu/token' && ctx.req.method === 'POST') {
    // console.log(',ctx.req url=====>',ctx.req.url);
    // console.log(',ctx.req methoid=====>',ctx.req.method);
    ctx.body = { token: createToken() }
  }
  next()
})

app.listen(7778)


console.log(',====>http://localhost:7778');

